/*    */ package com.iris.egrant.dao.proposal;
/*    */ 
/*    */ import com.iris.egrant.model.proposal.ProposalExtend;
import com.iris.egrant.orm.hibernate.HibernateDao;
/*    */ import java.util.List;
/*    */ import org.springframework.stereotype.Repository;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ @Repository
/*    */ public class ProposalExtendDao
/*    */   extends HibernateDao<ProposalExtend, Long>
/*    */ {
/*    */   public ProposalExtend getPrpExtendInfo(Long prpCode) {
/* 25 */     return (ProposalExtend)findUniqueBy("prpCode", prpCode);
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public ProposalExtend getProposalExtend4Sync(Long prpCode) {
/* 36 */     return (ProposalExtend)findUnique("from ProposalExtend where prpCode = ? ", new Object[] { prpCode });
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public List<ProposalExtend> getProposalExtend4Split() {
/* 47 */     return find("from ProposalExtend where compareOrgStatus = 1 ", new Object[0]);
/*    */   }
/*    */ 
/*    */   
/*    */   public List<Long> getPrpCode4Split(int maxResults) {
/* 52 */     return getSession().createQuery("select pe.prpCode from ProposalExtend pe where pe.compareOrgStatus = 1").setMaxResults(maxResults).list();
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public void createProposalExtend4Sync(ProposalExtend proposalExt) {
/* 63 */     getSession().merge(proposalExt);
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public void addElement(Long posCode, String comment) {
/* 73 */     String node = "<recommended_comment>" + comment + "</recommended_comment>";
/* 74 */     String nodeExistSql = " select Existsnode(t.prp_xml, 'data/proposal/recommended_comment') as nodeCount  from proposal_cached_extend t where t.pos_code = " + posCode;
/* 75 */     String nodeCount = getSessionFactory().getCurrentSession().createSQLQuery(nodeExistSql).list().get(0).toString();
/* 76 */     if ("0".equals(nodeCount)) {
/* 77 */       String addNodeSql = "update proposal_cached_extend t set t.prp_xml = APPENDCHILDXML(t.prp_xml, '/data/proposal',  sys.xmlType.createXML('" + node + "'))  where t.pos_code = " + posCode;
/* 78 */       getSessionFactory().getCurrentSession().createSQLQuery(addNodeSql).executeUpdate();
/*    */     } else {
/*    */       
/* 81 */       String alterNodeSql = "update proposal_cached_extend t set t.prp_xml = updatexml(t.prp_xml, '/data/proposal/recommended_comment', '" + node + "') where t.pos_code = " + posCode;
/* 82 */       getSessionFactory().getCurrentSession().createSQLQuery(alterNodeSql).executeUpdate();
/*    */     } 
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public void delElement(Long posCode) {
/* 94 */     String node = " ";
/* 95 */     String nodeExistSql = " select Existsnode(t.prp_xml, 'data/proposal/recommended_comment') as nodeCount  from proposal_cached_extend t where t.pos_code = " + posCode;
/* 96 */     String nodeCount = getSessionFactory().getCurrentSession().createSQLQuery(nodeExistSql).list().get(0).toString();
/* 97 */     if ("1".equals(nodeCount)) {
/* 98 */       String alterNodeSql = "update proposal_cached_extend t set t.prp_xml = updatexml(t.prp_xml, '/data/proposal/recommended_comment', '" + node + "') where t.pos_code = " + posCode;
/* 99 */       getSessionFactory().getCurrentSession().createSQLQuery(alterNodeSql).executeUpdate();
/*    */     } 
/*    */   }
/*    */ }


/* Location:              D:\文件kjt\WEB-INF\lib\egrant-code-2.2.20240205.1659.jar!\com\iris\egrant\dao\proposal\ProposalExtendDao.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */